package com.compiler.lexico.action;

import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Collection;
import java.util.Vector;

import com.compiler.lexico.token.SymbolTable;
import com.compiler.lexico.token.Token;

public class CompositeAction extends AbstractAction {
	private Collection<AbstractAction> actions;
	
	public CompositeAction(Token token, SymbolTable symbolTable) {
		super(token,symbolTable);
		//System.out.println("CompositeAction");
		this.actions = new Vector<AbstractAction>();
	}
	
	public void addAction(AbstractAction action) {
		this.actions.add(action);
	}
	
	@Override
	public void exec(RandomAccessFile raf) throws IOException {
		for(AbstractAction action : actions)
			action.exec(raf);
	}
	
	public String toString() {
		String ret = new String();
		for(AbstractAction action : actions)
			ret += action.toString()+",";
		return ret;
	}

}
